package com.gaofei.storage.controller;

import com.gaofei.storage.domain.TbStorage;
import com.gaofei.storage.service.TbStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("storage")
public class StorageController {

    @Autowired
    TbStorageService tbStorageService;


    @RequestMapping("reduce")
    public Boolean reduce(){
        //1.先查询原来的库存
        TbStorage ts = tbStorageService.getById(1);
        ts.setCount(ts.getCount()-1);
        //2.减库存
        boolean b = tbStorageService.updateById(ts);
        return b;
    }
}
